/********************************************
 * 功能说明: 
 * 模块名称: 
 * 系统名称: 
 * 软件版权: 
 * 系统版本: 1.0.0
 * 开发人员: zhangfb
 * 开发时间: 2019/5/29 19:47
 * 审核人员: 
 * 相关文档: 
 * 修改记录: 修改日期 修改人员 修改说明
 *********************************************/
package com.hyacinth.aurora.mvc;

import com.hyacinth.aurora.core.context.ThreadLocalHolder;
import com.hyacinth.aurora.mvc.request.AuroraRequest;
import com.hyacinth.aurora.mvc.response.AuroraResponse;

/**
 * 系统上下文
 * @author zhangfb
 * @version 1.0.0.1
 * @since JDK 1.8
 */
public final class AuroraContext {

    private AuroraRequest request;    // 请求
    private AuroraResponse response;  // 响应

    public AuroraContext(AuroraRequest request, AuroraResponse response) {
        this.request = request;
        this.response = response;
    }

    public static AuroraRequest getRequest(){
        return AuroraContext.getContext().request ;
    }

    public static AuroraResponse getResponse(){
        return AuroraContext.getContext().response;
    }

    public static void setContext(AuroraContext context) {
        ThreadLocalHolder.setAuroraContext(context);
    }

    public static void removeContext() {
        ThreadLocalHolder.removeAuroraContext();
    }

    public static AuroraContext getContext() {
        return ThreadLocalHolder.getAuroraContext();
    }
}